package com.biz.primus.ms.homepage.trans;


import com.biz.primus.common.utils.JsonUtils;
import com.biz.primus.homepage.vo.CoverTemplateData;
import com.biz.primus.homepage.vo.ProgramRoVo;
import com.biz.primus.homepage.vo.ProgramUpdateReqVo;
import com.google.common.base.Function;

/**
 * Created by jiangnan on 2017/7/17.
 */
public class ProgramRoVo2ProgramUpdateReqVo implements Function<ProgramRoVo,ProgramUpdateReqVo> {
    @Override
    public ProgramUpdateReqVo apply(ProgramRoVo programRo) {
        ProgramUpdateReqVo respVo = new ProgramUpdateReqVo();
        respVo.setId(programRo.getId());
        respVo.setCoverId(programRo.getCoverId());
        respVo.setParentId(programRo.getParentId());
        respVo.setName(programRo.getName());
        respVo.setDescription(programRo.getDescription());
        respVo.setSourceId(programRo.getSourceId());
        respVo.setCoverTemplateData(JsonUtils.json2Obj(programRo.getDataJson(), CoverTemplateData.class));
        respVo.setStatus(programRo.getStatus());
        respVo.setTimeRangePolicy(programRo.getTimeRangePolicy());
        respVo.setStartTime(programRo.getStartTime());
        respVo.setEndTime(programRo.getEndTime());
        return respVo;
    }
}
